<%= form_for(@cultural_heritage_type_cultural_institution, :html => {:onsubmit => "return validate(this);"}) do |f| %>
  <% if @cultural_heritage_type_cultural_institution.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@cultural_heritage_type_cultural_institution.errors.count, "error") %> prohibited this cultural_heritage_type_cultural_institution from being saved:</h2>

      <ul>
      <% @cultural_heritage_type_cultural_institution.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>
<div class="shadow">
<fieldset id="agrupacion" >
<legend>Datos Básicos </legend>
  <div class="field">
    <label>Nombre:</label>
    <%= f.text_field :name %>
  </div>
  <div class="field">
    <label>Descripción:</label>
    <%= f.text_area :description %>
  </div>
</fieldset>
  <div class="actions">
    <%= f.submit "Enviar"%>
  </div>
</div>
<% end %>
<script type="text/javascript">
  // form validation function //
  function validate(form) {
    //input
    var name = form.cultural_heritage_type_cultural_institution_name.value;
    //select

    if(name == "") {
      inlineMsg('cultural_heritage_type_cultural_institution_name','Debe ingresar un nombre para el tipo de institucion cultural.',3);
      return false;
    }
    if(!name.match(nameRegex)) {
      inlineMsg('cultural_heritage_type_cultural_institution_name','Debe de ingresar un nombre válido.',3);
      return false;
    }
  }
</script>